import { DataResult } from "@/type";
import { $get, $post } from "./index";

export interface WorkerOrderOrderListParam {
  btcId: string;
  work: boolean;
  keywords: string;
  wxStatus?: number;
  pickUpMode?: number;
  examineFlag?: boolean;
  record?: boolean;
  startBillingTime?: string;
  endBillingTime?: string;
}
export interface Page {
  pageSize: number;
  pageNum: number;
}
//    网点运单
export const getByCustomer = (page: Page, data: WorkerOrderOrderListParam) => {
  return $post(
    `/selfmachine-system/workerIndex/listNew?pageSize=${page.pageSize}&pageNum=${page.pageNum}`,
    data
  );
};

export interface WaitForConfirmParam {
  pageNum: number;
  pageSize: number;
  startBillingTime: string;
  endBillingTime: string;
}

// 代签收
export const waitForReceive = (data: WaitForConfirmParam) => {
  return $post(
    `/selfmachine-system/workerIndex/waitForReceiveNew?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    data
  );
};

// 待审核
export const waitForConfirm = (data: WaitForConfirmParam) => {
  return $post(
    `/selfmachine-system/workerIndex/waitExamineNew?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    data
  );
};

// 待确认
export const waitAscertain = (data: WaitForConfirmParam) => {
  return $get(
    `/selfmachine-system/workerIndex/waitForConfirm?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    data
  );
};

export interface WorkLoginParam {
  /**
   *  工作人员账号
   */
  staffNo: string;
  /**
   * 工作人员密码
   */
  password: string;
  /**
   *  自助机id
   */
  btssId: number;
  /**
   * 网点编号
   */
  companyNo: string;
  /**
   *  是否需要验证
   */
  needVerify: boolean;
}

//值班员登录
export const workLogin = (
  data: WorkLoginParam
): Promise<Taro.request.SuccessCallbackResult<DataResult<any>>> => {
  return $post("/selfmachine-auth/customer/login", data);
};


/* 我的待办 */
export interface myPendingParams {
  pageNum: number;
  pageSize: number;
}
export const getMyPending = (data: myPendingParams) => {
  return $post(
    `/selfmachine-system/workerIndex/myPending?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,{}
  );
};

/* 网点查询 */
export interface getBranchByAreaParams {
  btcId: string;
  province: string;
  city: string;
  administrativeDivision: string;
}
export const getBranchByArea = (data: getBranchByAreaParams) => {
  return $get(
    `/selfmachine-system/branch/getBranchByArea`,data
  );
};

/* 网点查询 - 业务 */
export interface getParticularsParams {
  branchCompanyNo:string; // 网点编号
}
export const getParticulars = (data: getParticularsParams) => {
  return $get(
    `/selfmachine-system/branch/particulars`,data
  );
};

